package com.travel.model.entity.content;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.persistence.*;
import lombok.Data;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import java.time.LocalDateTime;
import java.util.HashSet;
import java.util.Set;

@Data
@Entity
@Table(name = "tags")
@EntityListeners(AuditingEntityListener.class)
@Schema(description = "Tag entity")
public class Tag {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Schema(description = "Tag ID")
    private Long id;

    @Schema(description = "Tag name")
    @Column(nullable = false, unique = true)
    private String name;

    @Schema(description = "Tag description")
    private String description;

    @Schema(description = "Tag status (1: active, 0: inactive)")
    private Integer status = 1;

    @ManyToMany(mappedBy = "tags")
    private Set<TravelGuide> travelGuides = new HashSet<>();

    @CreatedDate
    @Schema(description = "Creation time")
    private LocalDateTime createdTime;

    @LastModifiedDate
    @Schema(description = "Last update time")
    private LocalDateTime updateTime;
} 